package cn.vcjf.weapp.api.active.service;

import cn.vcjf.weapp.api.active.entity.GoodsActiveRecord;
import cn.vcjf.weapp.api.goods.entity.GoodsOrder;
import cn.vcjf.weapp.api.goods.entity.GoodsRefundOrder;
import cn.vcjf.weapp.common.web.TableResult;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author zhengzihang
 * @since 2018-09-26
 */
public interface GoodsActiveRecordService extends IService<GoodsActiveRecord> {

	GoodsActiveRecord selectCollageForUpdateById(Integer id);

	@Transactional(readOnly = false)
	TableResult doJoinGoodsCoollage(GoodsActiveRecord goodsActiveRecord, GoodsOrder goodsOrder);

	GoodsActiveRecord selectCollageById(Integer id);

	TableResult addGoodsCollageOrder(GoodsActiveRecord goodsActiveRecord, GoodsOrder goodsOrder);

	TableResult cancelGoodsCollage(GoodsActiveRecord goodsActiveRecord);

	GoodsRefundOrder buildActiveRefundOrder(GoodsActiveRecord goodsActiveRecord);

	TableResult joinBargaining(GoodsActiveRecord goodsActiveRecord);

	List<GoodsActiveRecord> selectActivePage(Page<GoodsActiveRecord> page, GoodsActiveRecord goodsActiveRecord);

	int updateExpireActiveRecord();

	JSONObject sendMinAppCutMessage(GoodsActiveRecord record, String openId, String form_id);

	JSONObject sendMinAppTeamMessage(GoodsActiveRecord record, String openId, String form_id);

	JSONObject sendMinAppDeliveryMessage(GoodsOrder order, String form_id);
}
